using System;
using System.Data;
using System.Web;
using System.Web.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class RadioButtonListPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
            if (RadioButtonList1.SelectedValue != "")
            {

                Literal1.Text  = 
                RadioButtonList1.SelectedValue+ "-" + 
                RadioButtonList1.SelectedItem.Text + "<br>";
            }
            if (RadioButtonList2.SelectedValue != "")
            {

                Literal2.Text  = 
                RadioButtonList2.SelectedValue+ "-" + 
                RadioButtonList2.SelectedItem.Text + "<br>";
            }
        }
    }
    void LoadData()
    {
        string connectionString =
                WebConfigurationManager.ConnectionStrings[
                "RCVDB2000"].ConnectionString;

        ControlHelper cls = new
        ControlHelper(connectionString);
        cls.CommandText = 
        "select * from tblJobIndustries";
        cls.CommandType = CommandType.Text;
        cls.InitProperties();
        cls.FillDataTableToRadioButtonList(
        this.RadioButtonList1, 
        "JobIndustryName", "JobIndustryID", "2");

        cls.FillArrayListToRadioButtonList (
        this.RadioButtonList2, "None", "", "");
        cls.Finalize();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Literal1.Text = "";
         
        if (RadioButtonList1.SelectedValue != "")
        {

            Literal1.Text += 
            RadioButtonList1.SelectedValue+ "-" +
            RadioButtonList1.SelectedItem.Text + "<br>";
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Literal2.Text = "";

        if (RadioButtonList2.SelectedValue != "")
        {

            Literal2.Text += 
            RadioButtonList2.SelectedValue+ "-" +
           RadioButtonList2.SelectedItem.Text + "<br>";
        }
    }
}
